function iframeCallback(form,callback){
	var $form = $(form), $iframe = $("#callbackframe");
	if ($iframe.size() == 0) {
		$iframe = $("<iframe id='callbackframe' name='callbackframe' src='about:blank' style='display:none'></iframe>").appendTo("body");
	}
	form.target = "callbackframe";
	_iframeResponse($iframe[0],callback);
};
function _iframeResponse(iframe, callback){
	var $iframe = $(iframe), $document = $(document);
	layer.load(0);
	$iframe.bind("load", function(event){
		$iframe.unbind("load");
		layer.closeAll();
		if (iframe.src == "javascript:'%3Chtml%3E%3C/html%3E';" || // For Safari
				iframe.src == "javascript:'<html></html>';") { // For FF, IE
				return;
		}
		var doc = iframe.contentDocument || iframe.document;
		if (doc.readyState && doc.readyState != 'complete') return; 
		if (doc.body && doc.body.innerHTML == "false") return;
		var response;
		if (doc.XMLDocument) {
			response = doc.XMLDocument;
		} else if (doc.body){
			try{
				response = $iframe.contents().find("body").text();
				response = $.parseJSON(response);
			} catch (e){
				response = doc.body.innerHTML;
			}
		} else {
			response = doc;
		}
		callback(response);
	})
}
function listDialogAjaxDone(json){
	 if (json["result"] == "error") {
			layer.alert(json["message"],{icon:2});
	 } else if (json["result"] == "success") {
			if(parent.extendFunc){
					parent.extendFunc.reloadTable();
			}
			parent.layer.msg(json["message"]);
			parent.layer.closeAll("iframe");
   }
}

//浏览器提醒
function showNotification(title, msg,closeTime){
	var Notification = window.Notification || window.mozNotification || window.webkitNotification;
	if (Notification && Notification.permission === "granted") {
		var instance = new Notification(title, {body: msg,tag:"vx"});
		instance.onclick = function () {};
		instance.onerror = function () {};
		instance.onshow = function () {
	    setTimeout(function() {instance.close();}, closeTime);  
		};
		instance.onclose = function () {};
	}else if (Notification && Notification.permission !== "denied") {
		Notification.requestPermission(function (status) {
	 		if (Notification.permission !== status) {
		 		Notification.permission = status;
	 		}
		 	if (status === "granted") {
				var instance = new Notification(title, {body: msg,tag:"vx"});
				instance.onclick = function () {};
				instance.onerror = function () {};
				instance.onshow = function () {
					setTimeout(function(){instance.close();}, closeTime);  
				};
				instance.onclose = function () {};
			}else {
	 			return false
	 		}
	 	});
	}else{
	 	return false;
	}
}